<?php
namespace Repositories;

class DepartmentRepository extends \Doctrine\ORM\EntityRepository
{
    public function findAllList()
    {
        $results =  $this->_em->createQueryBuilder()
                ->select('d')
                ->from('Entities\Department', 'd')
                ->getQuery()
                ->getArrayResult()
                ;
        $ret = array();
        foreach ($results as $result) {
            $ret[] = array('key'=>$result['id'], 'value'=>$result['name']);
        }

        return $ret;
    }
}
